package inabit.inabitcompiler.productions.variable.types;

import inabit.compiler.parser.grammar.NonTerminal;
import inabit.compiler.parser.grammar.Production;
import inabit.compiler.parser.grammar.Symbol;
import inabit.compiler.parser.grammar.Terminal;
import inabit.inabitcompiler.lexical.InabitTokenClass;
import inabit.inabitcompiler.parser.InabitSemanticAction;

/**D -> : T*/
/**@author Rafael Rocha*/
public class D_Rule extends Production{

	private NonTerminal T;
	public D_Rule() {
		super("D");
	}

	@Override
	protected Symbol[] production(final NonTerminal nonTerminal) {
		T = new NonTerminal("T");
		
		Symbol[] symbols = {
				new Terminal(InabitTokenClass.COLON),
				T,
				new InabitSemanticAction(nonTerminal) {
					@Override
					public void execute() throws Exception {
						nonTerminal.code = T.code;
					}
				}
		};
		return symbols;
	}

}
